package com.lin.cloud.web;

import com.lin.cloud.service.ConsumerServiceImpl;
import com.lin.entity.JsonResult;
import com.lin.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author longyang.lin
 * @description
 * @create 2018年03月21日10:23
 */
@RestController
@RequestMapping("/consumer")
public class ConsumerController {

    @Autowired
    private ConsumerServiceImpl consumerService;

    @RequestMapping(value = "/getName/{name}", method = RequestMethod.GET)
    public String getName(@PathVariable String name) {
        String consumerName = this.consumerService.getName(name);
        return "consumer api:" + consumerName;
    }

    @RequestMapping(value = "/restTemplateGetName", method = RequestMethod.GET)
    public String restTemplateGetName(@RequestParam String name) {
        return this.consumerService.restTemplateGetName(name);
    }


    @RequestMapping(value = "/insert", method = RequestMethod.GET)
    public JsonResult<Student> insertStu() {
        return this.consumerService.insertStu();
    }
}
